// These are meant to be typed into the REPL. You can also run
// scala -Xnojline -Xnojline < repl-session.scala to run them all at once.

print("Answer: ")
println(42)

/* 1） 使用 + 拼接 */
println("Answer: " + 42)

/* 2）使用 %s */
printf("Hello, %s! You are %d years old.%n", "Fred", 42)

val name = "Fred"
val age = 42.333333

/* 3）使用变量引用 f"$var" */
print(f"Hello, $name! You are $age%7.2f years old%n")


/* 4）使用变量引用 s */
print(s"1+1=${1+1}! You are $age%7.2f years old%n")
// 1+1=2! You are 42.333333%7.2f years old%n

import scala.io._
val name2 = StdIn.readLine("Your name: ")

print("Your age: ")
val age2 = StdIn.readInt()

println(f"Hello, $name2! Next year, you will be ${age2 + 1}.", name, age + 1)

